﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using StoragePeriod.IDAL.FoodTesting;
using StoragePeriod.DALFactory;
using System.Data;
using StoragePeriod.Model.FoodTesting;

namespace StoragePeriod.BLL.FoodTesting
{
    /// <summary>
    /// 检测记录 操作
    /// </summary>
    public class T_FoodRecord
    {
        I_FoodRecord dal = new DataAccess<I_FoodRecord>().CreateInstance("FoodTesting.D_FoodRecord");

        /// <summary>
        /// 根据原料ID和检测日期获取检测记录列表
        /// </summary>
        /// <param name="eFoodRecord"></param>
        /// <returns></returns>
        public DataTable GetFoodRecordListByRawID(E_FoodRecord eFoodRecord)
        {
            return dal.GetFoodRecordListByRawIDS(eFoodRecord);
        }

        /// <summary>
        /// 删除检测记录
        /// </summary>
        /// <param name="eFoodRecord">要删除的检测记录</param>
        /// <returns></returns>
        public int Remove(E_FoodRecord eFoodRecord)
        {
            return dal.Remove(eFoodRecord);
        }

        /// <summary>
        /// 根据检测时间和原料ID 删除检测记录
        /// </summary>
        /// <param name="eFoodRecord">要删除的检测记录</param>
        /// <returns></returns>
        public int RemoveByFoodTime(E_FoodRecord eFoodRecord)
        {
            return dal.RemoveByFoodTime(eFoodRecord);
        }

        /// <summary>
        /// 根据原料ID和检测时间以及检测类型获取检测记录
        /// </summary>
        /// <param name="eFoodRecord">要获取的检测记录</param>
        /// <returns></returns>
        public E_FoodRecord GetFoodRecord(E_FoodRecord eFoodRecord)
        {
            return dal.GetFoodRecord(eFoodRecord);
        }

         /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(E_FoodRecord eFoodReord)
        {
            return dal.Add(eFoodReord);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(E_FoodRecord eFoodReord)
        {
            return dal.Update(eFoodReord);
        }

        /// <summary>
        /// 获取最新的检测结果
        /// </summary>
        /// <param name="eFoodReord"></param>
        /// <returns>返回最新的检测结果</returns>
        public E_FoodRecord GetNewFoodResult(E_FoodRecord eFoodRecord)
        {
            return dal.GetNewFoodResult(eFoodRecord);
        }
    }
}
